package com.mouliu.base.syn13;

import java.util.concurrent.LinkedBlockingDeque;

/**
 * @author mouliu
 * @create 2018-04-01-下午2:56
 */
public class UseDeque {
    public static void main(String[] args){
        LinkedBlockingDeque<String >dq =
                new LinkedBlockingDeque<>();

        dq.addFirst("a");
        dq.addFirst("b");
        dq.addFirst("c");
        dq.addFirst("d");
        dq.addFirst("e");
        dq.addFirst("f");
        dq.addLast("g");
        dq.addLast("h");
        dq.addLast("i");
        dq.addLast("j");
        System.out.println("查看头元素"+dq.peekFirst());
        System.out.println("元素长度"+dq.size());

        Object[] objs = dq.toArray();
        for (int i = 0; i < objs.length; i++) {
            System.out.println(objs[i]);
        }
    }
}
